chore(playwright): Rewrite password confirmation handler to avoid race conditions#62033
Open
DerDreschner wants to merge 1 commit into
Open
chore(playwright): Rewrite password confirmation handler to avoid race conditions#62033DerDreschner wants to merge 1 commit into
DerDreschner wants to merge 1 commit into
Conversation
Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
Copilot
AI
requested review from
icewind1991 and
provokateurin
and removed request for
a team
July 13, 2026 02:29
Copilot stopped work on behalf of
DerDreschner due to an error
July 13, 2026 02:46
Copilot stopped work on behalf of
DerDreschner due to an error
July 13, 2026 02:51
512a907 to
19b831c
Compare
odzhychko
requested changes
Jul 13, 2026
|
|
||
| if (dialogVisible) { | ||
| // Fill the password field | ||
| await expect(dialog).toBeVisible({ timeout: 500 }) |
Contributor
There was a problem hiding this comment.
Disclaimer: I'm not too to familiar with best-practices for Playwright.
But I'm pretty sure, expect should only be used for real assertions.
My research with Claude Opus 4.8 suggest to use waitFor. So something like this should work as expected:
const dialogVisible = await dialog
.waitFor({ state: "visible", timeout: 500 })
.then(() => true)
.catch(() => false);
if (!dialogVisible) {
return;
}
await dialog.locator('input[type="password"]').fill(password);
// Click the confirm button
await dialog.getByRole("button", { name: "Confirm" }).click();
// Wait for the dialog to disappear
await dialog.waitFor({ state: "hidden" });
susnux
reviewed
Jul 13, 2026
Comment on lines
+19
to
+27
| await expect(dialog).toBeVisible({ timeout: 500 }) | ||
| .then(async () => { | ||
| await dialog.locator('input[type="password"]').fill(password) | ||
|
|
||
| // Click the confirm button | ||
| await dialog.getByRole('button', { name: 'Confirm' }).click() | ||
|
|
||
| // Wait for the dialog to disappear | ||
| await dialog.waitFor({ state: 'hidden' }) | ||
| } | ||
| } catch { | ||
| // Dialog didn't appear, which is fine - some operations might not require confirmation | ||
| } | ||
| await expect(dialog).toBeHidden() | ||
| }) | ||
| .catch(() => { | ||
| // Dialog didn't appear — some operations don't require confirmation. | ||
| }) |
Contributor
There was a problem hiding this comment.
This is a async function so please use proper try {} catch {} blocks :)
Suggested change
| await expect(dialog).toBeVisible({ timeout: 500 }) | |
| .then(async () => { | |
| await dialog.locator('input[type="password"]').fill(password) | |
| // Click the confirm button | |
| await dialog.getByRole('button', { name: 'Confirm' }).click() | |
| // Wait for the dialog to disappear | |
| await dialog.waitFor({ state: 'hidden' }) | |
| } | |
| } catch { | |
| // Dialog didn't appear, which is fine - some operations might not require confirmation | |
| } | |
| await expect(dialog).toBeHidden() | |
| }) | |
| .catch(() => { | |
| // Dialog didn't appear — some operations don't require confirmation. | |
| }) | |
| try { | |
| await expect(dialog).toBeVisible({ timeout: 500 }) | |
| await dialog.locator('input[type="password"]').fill(password) | |
| await dialog.getByRole('button', { name: 'Confirm' }).click() | |
| await expect(dialog).toBeHidden() | |
| } catch { | |
| // Dialog didn't appear — some operations don't require confirmation. | |
| } |
Contributor
|
Just a thought: In the future this might be useful, if a test:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The password confirmation handler on playwright is using a timeout on
isVisible. That is deprecated and isn't being considered anymore, which lead to several issues during our playwright tests (especially under high load on our CI runners).When that issue occurs, the following error can be seen in the playwright tests. The timeout was raised to 90 seconds here and the issue still happened, as the whole test just stuck because of the login never being done.
Checklist
3. to review, feature component)stable32)AI (if applicable)